package com.panopset.centralen.grid;

import java.awt.Point;
import java.awt.Rectangle;
import java.util.Vector;

/**
 * Flat drawing surface.
 *
 * @author Karl Dinwiddie
 *
 */
public class Flat {

    /**
     * Mouse pressed x location.
     */
    private int pressedX = -1;

    /**
     * Mouse pressed y location.
     */
    private int pressedY = -1;

    /**
     * Report mouse dragged.
     *
     * @param x
     * @param y
     */
    public void mouseDragged(int x, int y) {
        // nothing to do here
    }

    /**
     * Report mouse moved.
     *
     * @param x
     * @param y
     */
    public void mouseMoved(int x, int y) {
        // nothing to do here
    }

    /**
     * Report mouse clicked.
     *
     * @param x
     * @param y
     */
    public void mouseClicked(int x, int y) {
        // nothing to do here
    }

    public void mousePressed(int x, int y) {
        pressedX = x;
        pressedY = y;
    }

    public void mouseReleased(int x, int y) {
        Rectangle r = new ShapeFactory().createRectangleFromPoints(new Point(x,
                y), new Point(pressedX, pressedY));
        addRectangle(r);
    }

    //TODO: this stuff belongs in another class

    public Vector<Rectangle> rects = new Vector<Rectangle>();

    private void addRectangle(Rectangle r) {
        rects.add(r);
    }

}
